const fs = require('fs');
const path = require('path');

// 创建样式文件的复制到一个无中文路径的位置
const sourcePath = path.resolve(__dirname, 'src/styles');
const targetPath = path.resolve(__dirname, 'temp_styles');

// 如果目标目录已存在，先删除
if (fs.existsSync(targetPath)) {
  fs.rmdirSync(targetPath, { recursive: true });
}

// 创建目标目录
fs.mkdirSync(targetPath, { recursive: true });

// 复制样式文件夹的内容到目标目录
const copyDir = (src, dest) => {
  const files = fs.readdirSync(src);
  files.forEach(file => {
    const srcPath = path.join(src, file);
    const destPath = path.join(dest, file);
    const stat = fs.statSync(srcPath);
    
    if (stat.isDirectory()) {
      fs.mkdirSync(destPath, { recursive: true });
      copyDir(srcPath, destPath);
    } else {
      fs.copyFileSync(srcPath, destPath);
    }
  });
};

copyDir(sourcePath, targetPath);
console.log('样式文件已复制到无中文路径的位置，SCSS 编译应该可以正常工作了'); 